$(document).ready(function () {
    resourceCategoryService.allCategory(getAllCategory);
});


function getAllCategory(category){
    var option = '<option value="">' + '-------请选择-------' + '</option>';
    for (var i = 0; i < category.length; i++) {
        option = option + '<option value="' + category[i].name + '">'
            + category[i].name + "</option>";
    }
    $('#category').html(option);
}



//获取目录对应格式
function verifyFileName() {
    //解决中文乱码问题的方法
    var categoryName = $("#category").val();
    var uploadFile = document.forms[0].upload.value;
    if("" != uploadFile){
        uploadFile = uploadFile.substring(uploadFile.lastIndexOf("\\") + 1).toLowerCase();
        resourceCategoryService.matchSufix(uploadFile,categoryName,categoryMessage);
    }
}

function categoryMessage(message){
    $("#sufix_result").html(message);
}


//给url地址加上时间戳,骗过浏览器,不读取缓存
//function convertURL(url) {
//    //获取时间戳
//    var timetamp = (new Date()).valueOf();
//    //将时间戳信息拼接到url中
//    if (url.indexOf("?") >= 0) {
//        url = url + "&t=" + timetamp;
//    } else {
//        url = url + "?t=" + timetamp;
//    }
//    //url = "personAjax&t=11111"
//    return url;
//}






